Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

243
Views
Why is my JSON object showing [Array] instead of the data in javascript after reformatting?

Currently I am trying to create a JSON object in java script which has an additional array containing all of the data that I currently posses:

src is a JSON object which before any code is run is equal to:

[
  {
    _id: new ObjectId("629ac43586b27bfd70337d06"),
    Title: 'Test Poll',
    Option: [ 'Test Option 1', 'Test Option 2', 'Test Option 3' ]
  },
  {
    _id: new ObjectId("629afc9286b27bfd70337d09"),
    Title: 'Test Poll 2',
    Option: [ 'Test Option 1' ]
  }
]

I need to reformat this object so that it is contained within a separate array which I am currently attempting to do with this line:

  var context = { poll:src };

This results in a reformatting of the JSON object which I do not understand, after running this code context contains:

  poll: [
    {
      _id: new ObjectId("629ac43586b27bfd70337d06"),
      Title: 'Test Poll',
      Option: [Array]
    },
    {
      _id: new ObjectId("629afc9286b27bfd70337d09"),
      Title: 'Test Poll 2',
      Option: [Array]
    }
  ]

It gets rid of the Option arrays and replaces them with [Array]. I need to keep these arrays and I am not sure what to change to fix this as I have tried looking elsewhere for answers. Does anyone have an idea of what is going on here?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ok they are arrays I am just too new to realize that it would not print fully. I was attempting to use handlebars on these Option arrays to print the list and I was forgetting to use the implicit this for the variable name instead of just 'Option'.

Problem solved.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!